<!-- 底部删除 -->
<template>
	<view class="container" :class="{'active': useShoppingCart.isShowDelete}"
		:style="{'paddingBottom': safeAreaBottom}">
		<view class="operation">
			<view class="radio-label" @click="checked = !checked">
				<text class="checkbox iconfont" :class="{'active': checked}">
					{{checked ? '&#xe62c;': '&#xe6a6;'}}
				</text>
				<text class="text">全选</text>
			</view>
			<button class="batch-btn btn-transition-scale9">批量清理</button>
			<button class="delete-btn btn-transition-scale9">删除</button>
		</view>
	</view>
</template>

<script setup>
	import { onBeforeMount, ref } from 'vue';
	import { useShoppingCartStore } from '../store.js';

	const props = defineProps({
		height: '',
		visible: false,
	});
	const emits = defineEmits('update:height');

	const safeAreaBottom = getApp().globalData.safeAreaBottom + 'px'; // 底部安全区域高度
	const useShoppingCart = useShoppingCartStore();
	const checked = ref(false);

	onBeforeMount(() => {
		emits('update:height', '122rpx');
	});
</script>

<style lang="scss" scoped>
	.container {
		position: absolute;
		bottom: 0;
		left: 0;
		width: 100%;
		transform: translateY(100%);
		transition: transform 0.2s;

		&.active {
			transform: translateY(0);
		}
	}

	.operation {
		display: flex;
		align-items: center;
		height: 122rpx;
		padding: 0 38rpx 0 28rpx;

		.radio-label {
			flex-grow: 1;
			display: flex;
			align-items: center;

			.checkbox {
				flex-shrink: 0;
				font-size: 40rpx;
				color: #DCDCDC;
				margin-right: 10rpx;
			
				&.active {
					color: #FE3333;
				}
			}

			.text {
				font-weight: 500;
				font-size: 24rpx;
				color: #999999;
			}
		}

		.batch-btn {
			width: 168rpx;
			height: 72rpx;
			font-weight: bold;
			font-size: 30rpx;
			color: #666666;
			text-align: center;
			line-height: 72rpx;
			background: transparent;
			border: 1px solid #D6D6D6;
			border-radius: 36rpx;
			box-sizing: border-box;
		}

		.delete-btn {
			width: 168rpx;
			height: 72rpx;
			font-weight: bold;
			font-size: 30rpx;
			color: #FFFFFF;
			text-align: center;
			line-height: 72rpx;
			background: #FE3333;
			border-radius: 36rpx;
			margin-left: 21rpx;
		}
	}
</style>